package cn.watson.controller;

import cn.watson.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Description: order接口
 * @Author: Zhangrui
 * @Version: 1.0
 * @Date:  2022/7/27 23:16
 */
@RestController
public class OrderController {

    // 注入工具类
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable Long id){
        String url = "http://user-server/getUserById/" + id;
        return restTemplate.getForObject(url, User.class);
    }


}
